The present invention relates to network switches generally and to their apparatus for managing packet memory in particular.
A network switch creates a network among a plurality of end nodes, such as workstations, and other network switches connected thereto. Each end node is connected to one port of the network. The ports also serve to connect network switches together.
Each end node sends packets of data to the network switch which the switch then routes either to another of the end nodes connected thereto or to a network switch to which the destination end node is connected. In the latter case, the receiving network switch routes the packet to the destination end node.
Each network switch has to temporarily store the packets of data which it receives from the units (end node or network switch) connected to it while the switch determines how, when and through which port to retransmit the packets. Each packet can be transmitted to only one destination address (a xe2x80x9cunicastxe2x80x9d packet) or to more than one unit (a xe2x80x9cmulticastxe2x80x9d or xe2x80x9cbroadcastxe2x80x9d packet). For multicast and broadcast packets, tie switch typically stores the packet only once and transmits multiple copies of the packet to some (multicast) or all (broadcast) of its ports. Once the packet has been transmitted to all of its destinations, it can be removed from the memory or written over.
It is common that some ports are more active than others. Thus, some ports receive most of the packets while other ports receive few of the packets. Therefore, the busier ports have longer backlogs than the other ports. To effectively operate, the network switch must actively manage the memory in which the packets are stored, noting which packets are to be shipped to which ports and which portions of memory are currently available. One common method for managing the memory is to provide a fixed buffer per port.
It is an object of the present invention to provide improved apparatus and method for managing the memory in which the incoming packets are stored.
There is therefore provided, in accordance with a preferred embodiment of the present invention, apparatus including an empty list, a storage buffer and apparatus for updating the storage buffer and empty list. The empty list includes a multiplicity of single bit buffers. The storage buffer includes a multiplicity of contiguous buffers, wherein each single bit buffer is associated with one of the contiguous buffers. The state of the bit of a single bit buffer indicates the empty or full state of the associated contiguous buffer and the address of a contiguous buffer is a simple function of the address or number of its associated single bit buffer. The updating apparatus stores data in and removes data from the contiguous buffers and correspondingly updates the states of the associated single bits buffers.
The method of the present invention associates the empty list with the storage buffer such that the address of each contiguous buffer is a simple function of the address or number of its associated single bit buffer and the state of the bit of a single bit buffer indicates the empty or fill state of the associated contiguous buffer. The method also stores data in and removes data from the contiguous buffers and correspondingly updates the states of the associated single bits buffers.
Additionally, in accordance with a preferred embodiment of the present invention, the contiguous buffers are large enough to store at least a packet of data. The contiguous buffers also can store multicast bits which, when set, indicate through which port the data stored in the contiguous buffer has to be transmitted.
Finally, in accordance with a preferred embodiment of the present invention, the memory management unit includes a bit clearing unit which considers a group of single bit buffers at a time. Per group of buffers, the bit clearing unit determines if any bits stored in the group of single bit buffers remain set during a predetermined length period T (the set state of a single bit indicates the full state of the associated contiguous buffer). Alternatively, the bit clearing unit keeps a running sum of the number of single bit buffers that remained set during period T, and compares the running sum to a predetermined threshold of maximum allowed set single bit buffers.